package cn.iocoder.yudao.module.famous.doctor.dal.mysql.versioncontrol;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.versioncontrol.VersionControlDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.versioncontrol.vo.*;

/**
 * 版本控制 Mapper
 *
 * @author 启航
 */
@Mapper
public interface VersionControlMapper extends BaseMapperX<VersionControlDO> {

    default PageResult<VersionControlDO> selectPage(VersionControlPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VersionControlDO>()
                .eqIfPresent(VersionControlDO::getAppType, reqVO.getAppType())
                .eqIfPresent(VersionControlDO::getPlatformType, reqVO.getPlatformType())
                .eqIfPresent(VersionControlDO::getIsForce, reqVO.getIsForce())
                .eqIfPresent(VersionControlDO::getVersion, reqVO.getVersion())
                .eqIfPresent(VersionControlDO::getUrl, reqVO.getUrl())
                .betweenIfPresent(VersionControlDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VersionControlDO::getId));
    }

    default List<VersionControlDO> selectList(VersionControlExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<VersionControlDO>()
                .eqIfPresent(VersionControlDO::getAppType, reqVO.getAppType())
                .eqIfPresent(VersionControlDO::getPlatformType, reqVO.getPlatformType())
                .eqIfPresent(VersionControlDO::getIsForce, reqVO.getIsForce())
                .eqIfPresent(VersionControlDO::getVersion, reqVO.getVersion())
                .eqIfPresent(VersionControlDO::getUrl, reqVO.getUrl())
                .betweenIfPresent(VersionControlDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VersionControlDO::getId));
    }

}
